<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Classes extends Admin_Controller {

	public function __construct()
	{
		parent::__construct();
	}
	public function index()
	{
		$data['info']="hello worldxxxxxxxxxxxx";
		$this->load->view('Index/index',$data);
	}
	
	public function lists()
	{
		$page=isset($_REQUEST['page'])?($_REQUEST['page']):0;
		$this->load->model('ClassService','cas');
		list($data['list'],$data['pageHtml'])=$this->cas->getClassList(0,$page);
		$this->load->view('Classes/lists',$data);
	}
	
	//新增分类
	public function add(){
		$this->load->model('ClassService','cas');
		$data['list']=$this->cas->getAllClassList();
		$this->load->view('Classes/add',$data);
	}
	
	//保存分类
	public function save(){
		$data['title']=$_POST['title'];
		$data['pid']=(int)$_POST['pid'];
		$this->load->model('ClassService','cas');
		$this->cas->save($data);

		//重定向
		$this->load->helper('url');
		redirect('Admin/classes/lists');
	}
	
	//子分类
	public function children_list(){
		$pid=intval($_GET['id']);
		
		
	}
}

/* End of file welcome.php */
/* Location: ./public/controllers/welcome.php */